package gui.visu.listeners;

import gui.visu.dialogs.JDialogAddDisplayDataAtPosition;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import controls.DataControl;
import data.Constants;


/**
 * @author Charles Perin
 * 29 mars 2011
 * LIMSI - INRIA Rennes
 * charles.perin@free.fr
 *
 */
public class ListenerAddDisplayDataInSpecificPositionButton implements ActionListener{
	
	private DataControl dataControl;
	
	public ListenerAddDisplayDataInSpecificPositionButton(DataControl dataControl){
		setDataControl(dataControl);
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		String[] displayDatas = dataControl.getDisplayDataList().getDisplayDataNamesInTab(Constants.DISPLAY_DATA_INACTIVE);
		int nbPositions = dataControl.getDisplayDataList().getNbActiveDisplayData();
		
		JDialogAddDisplayDataAtPosition dial = new JDialogAddDisplayDataAtPosition(dataControl,"Add Display Data in Specific position", false, displayDatas, nbPositions);
		dial.setLocationRelativeTo(dataControl.getIhm());
		dial.setVisible(true);
		dataControl.getIhm().setEnabled(false);
	}

	public void setDataControl(DataControl dataControl) {
		this.dataControl = dataControl;
	}

	public DataControl getDataControl() {
		return dataControl;
	}

}
